package cn.inbot.shopadmin.app;

import android.app.Application;
import android.content.Context;

import cn.inbot.shopadmin.BuildConfig;
import cn.inbot.lib.framework.PBApplication;
import cn.inbot.lib.log.LogConfig;
import cn.inbot.lib.log.PBLogManager;
import cn.inbot.lib.log.printer.ConsolePrinter;
import cn.inbot.lib.log.printer.FilePrinter;
import cn.inbot.lib.log.printer.ViewPrinter;

/**
 * Created by shisenkun on 2021/5/8.
 */
public class DemoApp extends PBApplication {

    private static final String LOG_TAG = "DemoApp";

    @Override
    public void initApp() {
        LogConfig globalLogConfig = LogConfig.Companion.build()
                .addLogPrinter(new ConsolePrinter())
                .addLogPrinter(new ViewPrinter((Context) PBApplication.Companion.getAppContext()))
                .addLogPrinter(new FilePrinter(AppConfig.CACHE_DIR_LOG, 0L, new String[]{"DemoApp"}));
        PBLogManager.INSTANCE.init((Application) this)
                .setGlobalLogConfig(globalLogConfig)
                .setGlobalTag(LOG_TAG);
    }

    @Override
    public boolean isProduceEnvironment() {
        return BuildConfig.isProduct;
    }

    @Override
    public float setAppDisplayWidthDpDatum() {
        return AppConfig.APP_DISPLAY_WIDTH_DP_DATUM;
    }

}
